package com.lxw.study.structural.composite.case2;

public class Client {
    public static void main(String[] args) {
        // 创建文件和文件夹
        FileSystemComponent file1 = new File("file1.txt");
        FileSystemComponent file2 = new File("file2.txt");
        FileSystemComponent folder1 = new Folder("Folder 1");
        FileSystemComponent folder2 = new Folder("Folder 2");

        // 组合节点包含叶子节点
        folder1.addComponent(file1);
        folder1.addComponent(file2);

        // 组合节点包含另一个组合节点
        folder2.addComponent(folder1);

        // 显示整个文件系统结构
        folder2.display();
    }
}
